using MicroMsg.Manager;
using MicroMsg.UI.Page;
using MicroMsg.UI.Util;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class OtherSettingView : BasePage
	{
		private ApplicationBar mBar;
		internal Grid ContentPanel;
		internal Button btnBlackList;
		internal Button btnClearData;
		internal Button btnAboutMM;
		internal TextBlock txtVersion;
		internal Button btnFeedback;
		internal Button btnChangeTheme;
		private bool _contentLoaded;
		public OtherSettingView()
		{
			this.InitializeComponent();
		}
		protected override void OnPageIn(object[] object_0)
		{
			this.initData();
		}
		private void initData()
		{
			string text = "版本" + ConstantValue.VERSION;
			this.txtVersion.set_Text(text);
		}
		public ApplicationBar GetApplicationBar()
		{
			return null;
		}
		private void txtBlackList_Click(object sender, RoutedEventArgs e)
		{
			PhoneApplicationFrame phoneApplicationFrame = Application.get_Current().get_RootVisual() as PhoneApplicationFrame;
			BasePage basePage = phoneApplicationFrame.get_Content() as BasePage;
			if (basePage != null)
			{
				basePage.GoToPage("/Source/UI/Setting/BlackListPage.xaml", null, false);
			}
		}
		private void txtClearData_Click(object sender, RoutedEventArgs e)
		{
			MMMessageBox mMMessageBox = MMMessageBox.Show("清空聊天记录", "清空你手机上所有单人和群聊的聊天记录", true, "确定", "取消");
			mMMessageBox.set_FontSize(22.0);
			mMMessageBox.ReturnEvent = new DlgReturnEvent(this.MsgBoxClearDataHandler);
		}
		public void MsgBoxClearDataHandler(DlgReturnEventArg dlgReturnEventArg_0)
		{
			switch (MMMessageBox.GetUserClickResult(dlgReturnEventArg_0))
			{
			case 0:
				ChatMsgMgr.ClearAllMsg();
				MMMessageBox.Show("已清空所有聊天记录!", true, "确定");
				break;
			case 1:
				break;
			default:
				return;
			}
		}
		private void txtAboutMM_Click(object sender, RoutedEventArgs e)
		{
			PhoneApplicationFrame phoneApplicationFrame = Application.get_Current().get_RootVisual() as PhoneApplicationFrame;
			BasePage basePage = phoneApplicationFrame.get_Content() as BasePage;
			if (basePage != null)
			{
				basePage.GoToPage("/Source/UI/Setting/AboutMMPage.xaml", null, false);
			}
		}
		private void txtFeedback_Click(object sender, RoutedEventArgs e)
		{
			PhoneApplicationFrame phoneApplicationFrame = Application.get_Current().get_RootVisual() as PhoneApplicationFrame;
			BasePage basePage = phoneApplicationFrame.get_Content() as BasePage;
			if (basePage != null)
			{
				basePage.GoToPage("/Source/UI/Setting/FeedBackPage.xaml", null, false);
			}
		}
		private void changeTheme_Click(object sender, RoutedEventArgs e)
		{
			MMThemeTypes currentTheme = MMThemeTypes.COOL_BLACK_THEME;
			string string_ = "已经切换为灰色主题";
			if (MMTheme.getThemeType() == MMThemeTypes.COOL_BLACK_THEME)
			{
				string_ = "已经切换为绿色主题";
				currentTheme = MMThemeTypes.NORMAL_THEME;
			}
			MMMessageBox.Show(string_, true, "确定");
			MMTheme.GetInstance().ChangeTheme(currentTheme);
			MMTheme.SaveThemeType(currentTheme);
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/Setting/OtherSettingView.xaml", 2));
			this.ContentPanel = (Grid)base.FindName("ContentPanel");
			this.btnBlackList = (Button)base.FindName("btnBlackList");
			this.btnClearData = (Button)base.FindName("btnClearData");
			this.btnAboutMM = (Button)base.FindName("btnAboutMM");
			this.txtVersion = (TextBlock)base.FindName("txtVersion");
			this.btnFeedback = (Button)base.FindName("btnFeedback");
			this.btnChangeTheme = (Button)base.FindName("btnChangeTheme");
		}
	}
}
